.class public final Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice$usbReadCallback$1;
.super Ljava/lang/Object;
.source "NmeaUSBDevice.kt"

# interfaces
.implements Lcom/felhr/usbserial/UsbSerialInterface$UsbReadCallback;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;-><init>(Landroid/hardware/usb/UsbDevice;Landroid/hardware/usb/UsbManager;Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x19
    name = null
.end annotation

.annotation system Ldalvik/annotation/SourceDebugExtension;
    value = "SMAP\nNmeaUSBDevice.kt\nKotlin\n*S Kotlin\n*F\n+ 1 NmeaUSBDevice.kt\nlt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice$usbReadCallback$1\n*L\n1#1,110:1\n*E\n"
.end annotation


# instance fields
.field final synthetic this$0:Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;


# direct methods
.method constructor <init>(Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()V"
        }
    .end annotation

    .line 82
    iput-object p1, p0, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice$usbReadCallback$1;->this$0:Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public onReceivedData([B)V
    .locals 5

    .line 85
    iget-object v0, p0, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice$usbReadCallback$1;->this$0:Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/providers/NMEADeviceManager;->getStatus()Llt/farmis/libraries/externalgps/providers/Status;

    move-result-object v0

    sget-object v1, Llt/farmis/libraries/externalgps/providers/Status;->CONNECTED:Llt/farmis/libraries/externalgps/providers/Status;

    invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_3

    .line 86
    iget-object v0, p0, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice$usbReadCallback$1;->this$0:Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;->setLastPoll(J)V

    if-eqz p1, :cond_0

    .line 88
    invoke-static {}, Ljava/nio/charset/Charset;->defaultCharset()Ljava/nio/charset/Charset;

    move-result-object v0

    const-string v1, "Charset.defaultCharset()"

    invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    new-instance v1, Ljava/lang/String;

    invoke-direct {v1, p1, v0}, Ljava/lang/String;-><init>([BLjava/nio/charset/Charset;)V

    goto :goto_0

    :cond_0
    const-string v1, ""

    :goto_0
    const-string p1, "$"

    const/4 v0, 0x0

    const/4 v2, 0x2

    const/4 v3, 0x0

    .line 90
    invoke-static {v1, p1, v3, v2, v0}, Lkotlin/text/StringsKt;->contains$default(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_2

    .line 91
    iget-object v4, p0, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice$usbReadCallback$1;->this$0:Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    invoke-virtual {v4}, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;->getMessagePart()Ljava/lang/String;

    move-result-object v4

    invoke-static {v4, p1, v3, v2, v0}, Lkotlin/text/StringsKt;->contains$default(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z

    move-result p1

    if-eqz p1, :cond_1

    iget-object p1, p0, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice$usbReadCallback$1;->this$0:Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    invoke-virtual {p1}, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;->getMessagePart()Ljava/lang/String;

    move-result-object p1

    const-string v4, "*"

    invoke-static {p1, v4, v3, v2, v0}, Lkotlin/text/StringsKt;->contains$default(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z

    move-result p1

    if-eqz p1, :cond_1

    .line 92
    iget-object p1, p0, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice$usbReadCallback$1;->this$0:Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    invoke-virtual {p1}, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;->getMessagePart()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Llt/farmis/libraries/externalgps/providers/NMEADeviceManager;->setLastMessage(Ljava/lang/String;)V

    .line 94
    :cond_1
    iget-object p1, p0, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice$usbReadCallback$1;->this$0:Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    invoke-virtual {p1, v1}, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;->setMessagePart(Ljava/lang/String;)V

    goto :goto_1

    .line 96
    :cond_2
    iget-object p1, p0, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice$usbReadCallback$1;->this$0:Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    invoke-virtual {p1}, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;->getMessagePart()Ljava/lang/String;

    move-result-object v0

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;->setMessagePart(Ljava/lang/String;)V

    :cond_3
    :goto_1
    return-void
.end method
